﻿<Window x:Class="MVVM.SKI.View"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="View" Height="212" Width="619">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="3*" />
            <ColumnDefinition Width="2*" />
        </Grid.ColumnDefinitions>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*" />
                <ColumnDefinition Width="3*" />
            </Grid.ColumnDefinitions>
            <Label Content="Events:"  Margin="5" HorizontalContentAlignment="Left"  VerticalContentAlignment="Center"  />
            <ComboBox Grid.Column="1" Margin="5" ItemsSource="{Binding Events}"  
                      DisplayMemberPath="Name" SelectedItem="{Binding CurrentEvent}" />
            <DataGrid AutoGenerateColumns="False" Grid.ColumnSpan="2" Grid.Row="1"  Margin="5" 
                      ItemsSource="{Binding CurrentCompetitors}" IsReadOnly="True" 
                      SelectedItem="{Binding SelectedCompetitor, Mode=TwoWay}" >
                <DataGrid.Columns>
                    <DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="2*"/>
                    <DataGridTextColumn Header="Year of Birth" Binding="{Binding YearOfBirth}" Width="1*"/>
                </DataGrid.Columns>
            </DataGrid>
        </Grid>
        <Grid Grid.Column="1">
            <Grid.Resources>
                <Style TargetType="Label">
                    <Setter Property="Margin" Value="3"/>
                    <Setter Property="VerticalContentAlignment" Value="Center"/>
                    <Setter Property="HorizontalContentAlignment" Value="Right"/>
                    <Setter Property="FontWeight" Value="Black"/>
                </Style>
                <Style TargetType="TextBox">
                    <Setter Property="Margin" Value="3"/>
                    <Setter Property="VerticalContentAlignment" Value="Center"/>
                    <Setter Property="HorizontalContentAlignment" Value="Left"/>
                    <Setter Property="Background" Value="LightCyan"/>
                </Style>
            </Grid.Resources>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="auto" />
                <RowDefinition Height="*" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="63*" />
                <ColumnDefinition Width="131*" />
            </Grid.ColumnDefinitions>
            <Label Content="Competitor Information" Grid.ColumnSpan="2" Margin="3"  
                   HorizontalContentAlignment="Center"  />
            <Label Content="Name:" Grid.Row="1"   />
            <TextBox Grid.Column="1" Grid.Row="1"  Text="{Binding SelectedCompetitor.Name}"   />
            <Label Content="Birth Year:" Grid.Row="2"   />
            <TextBox Grid.Column="1" Grid.Row="2"  Text="{Binding SelectedCompetitor.YearOfBirth}"   />
            <Button Content="Save" Grid.ColumnSpan="2" Grid.Row="3"  Margin="3" Command="{Binding SaveCommand}" />
        </Grid>
    </Grid>
</Window>
